﻿using HZU.ZP.Data.Interfaces.Resume;
using HZU.ZP.Domain.IService.Resume;
using HZU.ZP.Domain.Model.Resume;
using HZU.ZP.Domain.ServiceImpl.Mappers.Resume;
using System;
using System.Collections.Generic;
using System.Text;

namespace HZU.ZP.Domain.ServiceImpl.PCSvc.Resume
{
    public class ProjectExperienceService:IProjectExperienceService
    {
        private ProjectExperienceMapper _mapper = new ProjectExperienceMapper();
        private IProjectExperienceDao _sqlData;
        public ProjectExperienceService(IProjectExperienceDao sqlData)
        {
            _sqlData = sqlData;
        }

        public bool AddProjectExperience(ProjectExperience projectExperience)
        {
            var proExpDao = _mapper.MapToDao(projectExperience);
            _sqlData.AddProjectExperience(proExpDao);
            return true;
        }

        public bool DeleteProjectExperience(int id)
        {
            _sqlData.DeleteProjectExperience(id);
            return true;
        }

        public IList<ProjectExperience> GetProjectExperienceList(int applicantId)
        {
            return _mapper.MapToDomainList(_sqlData.GetProjectExperienceList(applicantId));
        }

        public bool UpdateProjectExperience(ProjectExperience projectExperience)
        {
            var proExpDao = _mapper.MapToDao(projectExperience);
            _sqlData.UpdateProjectExperience(proExpDao);
            return true;
        }
    }
}
